package com.adcc.automation.gui.Controller;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.svg.SVGGlyph;
import com.jfoenix.svg.SVGGlyphLoader;
import io.datafx.controller.ViewController;
import io.datafx.controller.flow.context.FXMLViewFlowContext;
import io.datafx.controller.flow.context.ViewFlowContext;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Label;

import javax.annotation.PostConstruct;


@ViewController(value = "/fxml/alert.fxml", title = "提示框")
public class MessageController {
    @FXMLViewFlowContext
    private ViewFlowContext context;
    
    @FXML
    public JFXButton close;
    
    @FXML
    public JFXButton confirm;
    
    @FXML
    private Label content;
    
    @PostConstruct
    public void initUI() throws Exception {
        context.register("alert",this);
        SVGGlyph closeSvg = SVGGlyphLoader.getIcoMoonGlyph("icon.svg" + ".close");
        closeSvg.setFill(javafx.scene.paint.Color.valueOf("#ffffff"));
        closeSvg.setSize(13, 13);
        close.setGraphic(closeSvg);
    }
    
    /**
     * 设置内容
     */
    public void updateContent(String text){
        Platform.runLater(() -> content.setText(text));
    }
}
